package com.fs.service.impl;


import com.fs.dao.UserDao;
import com.fs.pojo.User;
import com.fs.service.UserService;
import com.fs.utils.BeanFactories;
import com.fs.utils.IdWorker;
import com.fs.vo.UserVO;

import java.util.List;

/**
 * (TbUser)表服务实现类
 *
 * @author makejava
 * @since 2022-11-15 10:21:17
 */

public class UserServiceImpl implements UserService {

    private UserDao userDao = BeanFactories.getBean(UserDao.class);


    /**
     * 查询某个课的学生
     * @param intClassId 班级id
     * @return 返回该课的学生对象
     */
    @Override
    public List<User> queryStudentInClass(String intClassId) {
        return userDao.queryByClassId(intClassId);
    }
    /**
     * 手机号查询用户
     * @param phone
     * @return
     */
    @Override
    public User queryByPhone(String phone) {
        return userDao.queryByPhone(phone);
    }

    @Override
    public List<User> queryStudentByNameOrNumber(String intclassId, String contition) {
       return userDao.queryStudentByNameOrNumber(intclassId,contition);
    }
    @Override
    public UserVO queryById(String id) {
        return userDao.queryByIdReturnUserVO(id);
    }

    @Override
    public List<User> queryAll() {
        return null;
    }

    @Override
    public int insert(User obj) {

        //雪花生成id
        obj.setId(new IdWorker().nextId()+"");

        return userDao.insert(obj);
    }

    @Override
    public int deleteById(String id) {
        return 0;
    }

    @Override
    public int update(User obj) {
        return userDao.update(obj);
    }





}
